package com.gcxy.jk.shixunyi.controller;

import com.gcxy.jk.shixunyi.dto.OrderDto;
import com.gcxy.jk.shixunyi.dto.WxUserResponseDto;
import com.gcxy.jk.shixunyi.entity.Order;
import com.gcxy.jk.shixunyi.enums.OrderStatusEnum;
import com.gcxy.jk.shixunyi.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 订单列表
 */
@RequestMapping("/order")
@RestController
@Api(tags = "订单接口")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @ApiOperation(notes = "用户支付订单创建", value = "用户支付订单创建")
    @PostMapping("/createOrder/{openid}")
    public String createOrder(@PathVariable("openid") String openid,Long amount, Integer togetherNumber
            , LocalDateTime reservationTime, OrderStatusEnum status){
       return orderService.createOrder(amount,togetherNumber,reservationTime,status,openid);
    }

    @ApiOperation(notes = "用户订单信息", value = "用户订单信息")
    @GetMapping(value = "/getOrderByUserId/{id}")
    public List<Order> getOrderByUserId(@PathVariable("id") Long id){
       return orderService.getOrderByUserId(id);
    }

    @ApiOperation(notes = "用户所有订单信息", value = "用户所有订单信息")
    @GetMapping(value = "/getAllOrder")
    public List<Order> getAllOrder(){
        return orderService.getAllOrder();
    }
}
